// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Axios from "axios"
//elementui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

//avue-ui
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/theme-chalk/index.css';

//axios封装
import {postRequest, getRequest} from './assets/js/http.js'
Vue.prototype.postRequest = postRequest;
Vue.prototype.getRequest = getRequest;
Vue.config.productionTip = false;

// 时间转换方法
Vue.prototype.dateToString=function(date){
  var year = date.getFullYear();
  var month =(date.getMonth() + 1).toString();
  var day = (date.getDate()).toString();
  if (month.length == 1) {
    month = "0" + month;
  }
  if (day.length == 1) {
    day = "0" + day;
  }
  var dateTime = year + "-" + month + "-" + day;
  return dateTime;
};
  //消息提示
  Vue.prototype.msgShow=function(data,refershFun){
    if(data.data[0]==0){
      this.$message({
        message: data.data[1],
        type: 'success'
      });
      refershFun();
    }else{
      this.$message.error("失败！请检查");
      this.$message.error(data.data[1]);
    }
  };


/* eslint-disable no-new */
Vue.use(ElementUI);
Vue.use(Avue);
Vue.prototype.$http = Axios;
Vue.config.productionTip = false;
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
});
